package com.admin.dbdao;

import com.admin.bean.GoodSoftwareType;
import com.data.dbdao.BaseDao;
import org.springframework.stereotype.Repository;

import javax.transaction.Transactional;
import java.util.List;

/**
 * 精选软件的数据层
 *
 * @author:HingLo
 * @create 2017-10-09 11:11
 **/
@Repository
@Transactional
public class GoodSoftwareDao extends BaseDao {

    public List<GoodSoftwareType> findSoftwareTypeDao() {
        String hql = "from GoodSoftwareType";
        return (List<GoodSoftwareType>) super.findMassageDao(hql);
    }

    public boolean deleteGoodSoftwareDao(String id) {
        String hql = "delete GoodSoftware where rid=?";
        return super.updateManyMssageDao(hql, id) > 0;

    }

    public List<?> listGoodSoftwareDao(String gid) {
        String hql = "SELECT a.id,a.name from App as a where a.id in (SELECT rid from GoodSoftware WHERE gid=?) ";
        return super.findMassageDao(hql, gid);
    }
}
